<html>
<head><meta charset="utf-8"><title>Advice for auto traits · wg-traits · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/index.html">wg-traits</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html">Advice for auto traits</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210227292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210227292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210227292">(Sep 16 2020 at 06:57)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span><br>
It seems like the hard part of getting auto traits to work is checking whether a user-given impl exists.<br>
I looked into "impl_provided_for" to see how this works for ADTs but I think the current approach does not really work.</p>
<p>Consider for example this program:</p>
<div class="codehilite"><pre><span></span><code>#[auto] trait A {}
struct S&lt;T&gt; {}
struct E {}
struct B {}
impl !A for S&lt;E&gt; {}
</code></pre></div>


<p>In theory <code>S&lt;B&gt;: A</code> should hold as there is no negative impl for it.<br>
But the current impl_provided_for sees an impl for S&lt;_&gt; and understands that as an impl for S&lt;B&gt;. (as only the AdtId is compared)</p>
<p>I think whats really necessary here is to ask the solver whether <code>S&lt;B&gt;: A</code> or <code>S&lt;B&gt;: !A</code> has an implementation "without applying the auto rules",<br>
and if there is none, _then_ we should add our own auto-implementation.</p>
<p>Do you agree?</p>



<a name="210227535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210227535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210227535">(Sep 16 2020 at 07:01)</a>:</h4>
<p>In this particular case we could just extend impl_provided_for to also check whether the generic parameters match.<br>
But for more complex examples (like the following) we need to call the solver I think</p>
<div class="codehilite"><pre><span></span><code>#[auto] trait A {}
struct S&lt;T&gt; {}
struct E {}
struct B {}

trait Condition {}
impl Condition for E {}

impl&lt;T: Condition&gt; !A for S&lt;T&gt; {} // not valid chalk, but you get the idea
</code></pre></div>



<a name="210235843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210235843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210235843">(Sep 16 2020 at 08:49)</a>:</h4>
<p><span class="user-mention silent" data-user-id="335294">memoryleak47</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210227292">said</a>:</p>
<blockquote>
<p>I think whats really necessary here is to ask the solver whether <code>S&lt;B&gt;: A</code> or <code>S&lt;B&gt;: !A</code> has an implementation "without applying the auto rules",<br>
and if there is none, _then_ we should add our own auto-implementation.</p>
</blockquote>
<p>note: that is what rustc does, it first checks for impl candidates for <code>S&lt;B&gt;</code> (with both polarities), and if there is no impl candidates (or any other candidates, for that matter), only then adds auto trait candidates</p>



<a name="210241179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210241179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210241179">(Sep 16 2020 at 09:58)</a>:</h4>
<p><span class="user-mention" data-user-id="335294">@memoryleak47</span> this is incorrect, <code>impl !A for S&lt;E&gt;</code> <em>does</em> suppress the auto trait</p>



<a name="210241193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210241193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210241193">(Sep 16 2020 at 09:58)</a>:</h4>
<p>The idea is that we add an impl if you haven't said anything</p>



<a name="210241205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210241205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210241205">(Sep 16 2020 at 09:59)</a>:</h4>
<p>Otherwise, if you think about it, there would be no way to say that a struct is <em>not</em> <code>Send</code> (that would otherwise be Send)</p>



<a name="210241218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210241218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210241218">(Sep 16 2020 at 09:59)</a>:</h4>
<p>i.e., imagine you have <code>struct Foo;</code> and you want to declare that this is a marker type that is not meant to be send -- you kind of couldn't do it :)</p>



<a name="210241296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210241296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210241296">(Sep 16 2020 at 10:00)</a>:</h4>
<p>note that this design does cause a lot of surprise and is in fact still unstable in rustc, so it is not universally agreed that it should work this way; but I personally still think it's right, and in any case we ought to match rustc for now</p>



<a name="210241359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210241359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210241359">(Sep 16 2020 at 10:01)</a>:</h4>
<p>One thing that we were planning to add to rustc was to make it illegal to add negative impls that are conditional, which also helps to avoid the situation. That's never been done though.</p>



<a name="210241510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210241510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210241510">(Sep 16 2020 at 10:03)</a>:</h4>
<p>(One of the partial motivations here is that I wouldn't want to have to make the rules say "use the auto trait but only if no user-given trait applies...". That is kind of what happens with normalizing projects and it's trouble enough :) there is some precedent for handling it, I've read up a bit on some of the techniques folks use in the past -- but it's definitely an added complication that I don't Rust needs)</p>



<a name="210241532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210241532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210241532">(Sep 16 2020 at 10:03)</a>:</h4>
<p>(Although specialization also does something similar, but it doesn't introduce negation into the mix)</p>



<a name="210251946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210251946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210251946">(Sep 16 2020 at 12:11)</a>:</h4>
<p>Ah, interesting.<br>
So just to be sure <code>impl !A for S&lt;E&gt;</code>suppresses the auto trait for all <code>S&lt;_&gt;</code>, right?<br>
But considering your example - I don't understand why <code>impl !Send for Foo {}</code> would not work in that scenario.</p>



<a name="210278608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210278608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210278608">(Sep 16 2020 at 15:26)</a>:</h4>
<p>Currently <code>impl !A for S&lt;E&gt;</code> suppresses the auto trait for <code>S&lt;_&gt;</code> (with an inference variable) but not for <code>S&lt;F&gt;</code> where <code>F</code> is some type that does not unify with <code>E</code>, which is pretty unintuitive.</p>



<a name="210279472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210279472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210279472">(Sep 16 2020 at 15:32)</a>:</h4>
<p>hm... but given <code>impl !A for S&lt;E&gt; {}</code>, wouldn't then <code>A: S&lt;B&gt;</code> still hold in my example above?<br>
Because if I understood correctly, niko disagreed to this.</p>



<a name="210285069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210285069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210285069">(Sep 16 2020 at 16:14)</a>:</h4>
<p>Given <a href="https://github.com/rust-lang/chalk/blob/3ea88b7cc10de78b632962881e8b150dc5285281/chalk-solve/src/clauses.rs#L73">this</a> code (and <a href="https://github.com/rust-lang/rust/blob/5fae56971d8487088c0099c82c0a5ce1638b5f62/compiler/rustc_traits/src/chalk/db.rs#L327">this</a> somewhat, <em>any</em> impl for <code>S</code> suppresses the auto impl generation for all <code>S</code></p>



<a name="210285689"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210285689" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210285689">(Sep 16 2020 at 16:19)</a>:</h4>
<p>But, I think this behavior is different between rustc and Chalk atm</p>



<a name="210285808"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210285808" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210285808">(Sep 16 2020 at 16:20)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=b7f6c29e04a85a66d8b677b55a7f2d5e">https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=b7f6c29e04a85a66d8b677b55a7f2d5e</a></p>



<a name="210286016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210286016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210286016">(Sep 16 2020 at 16:22)</a>:</h4>
<p>For builtin types, what's the tricky part here?</p>



<a name="210290310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210290310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210290310">(Sep 16 2020 at 16:57)</a>:</h4>
<p>I guess implementing the rustc-like behaviour is somewhat tricky, but if the chalk-version was desired after all, then it shouldn't be too tricky.</p>



<a name="210291059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210291059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210291059">(Sep 16 2020 at 17:03)</a>:</h4>
<p>I think for now, it's okay to follow the Chalk logic of "any impl causes no auto impls at all"</p>



<a name="210548132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210548132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210548132">(Sep 18 2020 at 17:04)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span><br>
I implemented the auto trait handling for a few built-in types now. (see <a href="https://github.com/rust-lang/chalk/pull/612">https://github.com/rust-lang/chalk/pull/612</a>)<br>
Maybe you can have a look, in order to check whether it goes into the right direction. (:</p>



<a name="210550240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210550240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210550240">(Sep 18 2020 at 17:23)</a>:</h4>
<p>let me look</p>



<a name="210563351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210563351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210563351">(Sep 18 2020 at 19:13)</a>:</h4>
<p><span class="user-mention" data-user-id="335294">@memoryleak47</span> made a couple comments</p>



<a name="210564707"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210564707" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210564707">(Sep 18 2020 at 19:24)</a>:</h4>
<p>So, I implemented the chalk behavior as "the behavior I think rustc is meant to have"</p>



<a name="210564724"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210564724" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210564724">(Sep 18 2020 at 19:24)</a>:</h4>
<p>but rustc is a bit behind</p>



<a name="210565581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210565581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210565581">(Sep 18 2020 at 19:33)</a>:</h4>
<p>what I meant <span class="user-mention" data-user-id="335294">@memoryleak47</span> about <code>impl !Send for Foo</code> is I guess this, trying to explain as best I can:</p>
<p>We can imagine that "auto traits" and "negative impls" lower into fundamental chalk rules. Under the current setup, negative impls don't actually create any kind of "program clause" at the chalk level -- they just <em>suppress</em> the creation of program clauses. So you never get a <code>Implemented(Foo: Send)</code> rule at all.</p>
<p>If we wanted to say that we <em>always</em> add a <code>Implemented(Foo: Send)</code> rule for every struct <code>Foo</code> (plus all the generics; e.g., <code>forall&lt;T&gt; Implemented(Foo&lt;T&gt;: Send)</code> for a <code>struct Foo&lt;T&gt;</code>, etc., then we have to say that the negative impls lowers to a kind of "negative program clause" (e.g., <code>!Implemented</code>). This starts to get into what is called <em>defeasible</em> logics, because you can say that the negative program clause "defeats" the positive one.</p>
<p>To some extent, we already have a kind of defeasible logic, because specialization allows one to set defaults that get overridden, but those defaults are limited in some ways. For example, you are not allowed to "unimplement" something that was already implemented by a base impl, and you also can only override associated types that are marked as default -- and those "defeasible" associated types (which are marked as default) cannot be normalized during normal type-checking (by design). The reason we don't permit them to normalize is precisely so that we don't have to worry about having one rule that permits a conclusion and another rule that "defeats" that conclusion.  So that limits the points where we have to worry about defeasability (but only somewhat; we still have to be able to resolve to the correct result during code generation, so it may not be that useful).</p>
<p>(Note that the way I planned to implement the specialization logic is not to extend chalk with a first-class notion of defeasible rules but rather to incorporate negative goals, i.e., you can normalize a <code>default</code> associated type if you can show that no more specialized impls apply. This is basically an internal "lowering" step from a defeasible logic to a more limited one.)</p>
<p>Anyway, we could potentially in the future extend auto traits in this way. For now, negative impls are unstable, and I'd probably want to keep them that way until we finish implementing stabilization in chalk and have worked through some of those implications. (Or perhaps stabilize them but limited to cases where they apply to <em>all</em> instances of a type, so that we sidestep it.)</p>
<p>I guess that from an <em>expectations</em> point of view, I personally find this code rather unclear:</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="o">!</span><span class="nb">Send</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>I think it's rather unclear whether <code>Foo&lt;i32&gt;</code> is meant to be <code>Send</code> or not!</p>
<p>Anyway, that's how I see it right now.</p>



<a name="210565813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210565813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210565813">(Sep 18 2020 at 19:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210565581">said</a>:</p>
<blockquote>
<p>I guess that from an <em>expectations</em> point of view, I personally find this code rather unclear:</p>
<div class="codehilite"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="o">!</span><span class="nb">Send</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="kt">u32</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
</code></pre></div>


<p>I think it's rather unclear whether <code>Foo&lt;i32&gt;</code> is meant to be <code>Send</code> or not!</p>
</blockquote>
<p>To expand, and so I think I might prefer to err on the side of "no". On the other hand, people ask this question a lot, so maybe I'm just unique in finding it kind of unclear. I think what surprises me is that I <em>see</em> the <code>!Send</code> impl but I don't see the <code>impl Send</code> that is implicitly added, and so I feel like it's harder for me to know the full set of impls that exist, I could forget that the compiler is added a default one.</p>
<p>In contrast, when there is <em>no user-written impl at all</em>, it feels like "oh of course I have to remember the ones that the compiler added".</p>



<a name="210565912"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210565912" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210565912">(Sep 18 2020 at 19:36)</a>:</h4>
<p>I guess I should probably move this text somewhere more permanent.</p>



<a name="210566191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566191">(Sep 18 2020 at 19:39)</a>:</h4>
<p>I think the takeaway from this is that auto traits are <em>wierd</em></p>



<a name="210566204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566204">(Sep 18 2020 at 19:39)</a>:</h4>
<p>At least, more weird than they seem at first glance</p>



<a name="210566386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566386">(Sep 18 2020 at 19:41)</a>:</h4>
<p>Yeah, more complex than you might think at least!</p>



<a name="210566408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566408">(Sep 18 2020 at 19:41)</a>:</h4>
<p>I wonder if I would have proposed them if I'd fully understood what extra pain they add :P</p>



<a name="210566424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566424">(Sep 18 2020 at 19:41)</a>:</h4>
<p>on the other hand, I think that they still feel right from the usability perspective to me most of the time....</p>



<a name="210566450"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566450" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566450">(Sep 18 2020 at 19:41)</a>:</h4>
<p>though I don't know how much people get burned by the "implicit semver guarantee of send-ness"</p>



<a name="210566473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566473">(Sep 18 2020 at 19:42)</a>:</h4>
<p>it basically never affects me in my daily life</p>



<a name="210566506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566506">(Sep 18 2020 at 19:42)</a>:</h4>
<p>but I don't develop libraries that have to maintain strict semver etc</p>



<a name="210566536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566536">(Sep 18 2020 at 19:42)</a>:</h4>
<p>Well, it definitely starts to get even more hairy once you start thinking about opaque types and such</p>



<a name="210566580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566580">(Sep 18 2020 at 19:42)</a>:</h4>
<p>like <code>fn foo() -&gt; impl Trait</code> could or could not be <code>Send</code></p>



<a name="210566760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566760">(Sep 18 2020 at 19:44)</a>:</h4>
<p>yes. though that's definitely another case where the feature would be so much less usable...</p>



<a name="210566769"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210566769" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210566769">(Sep 18 2020 at 19:44)</a>:</h4>
<p>put another way, that's kind of the same as any struct I guess :)</p>



<a name="210567028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567028">(Sep 18 2020 at 19:46)</a>:</h4>
<p>Hmm, true. I guess with a struct, I just assume that the onus for <code>Send</code>/<code>!Send</code> is on the <em>struct</em>, whereas with <code>impl Trait</code>, it's instead on the <em>function</em></p>



<a name="210567224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567224">(Sep 18 2020 at 19:48)</a>:</h4>
<p>Additionally, docs here sort of change how these are viewed too</p>



<a name="210567259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567259">(Sep 18 2020 at 19:48)</a>:</h4>
<p>With a struct, you can go in rustdoc and see if that auto impls <code>Send</code>, with an <code>impl Trait</code> return you can't</p>



<a name="210567372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567372">(Sep 18 2020 at 19:49)</a>:</h4>
<p>(you could also write a static assert that a struct is <code>Send</code> whereas <code>impl Trait</code> no)</p>



<a name="210567691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567691">(Sep 18 2020 at 19:52)</a>:</h4>
<p>(we can fix that in the docs, but yes)</p>



<a name="210567742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567742">(Sep 18 2020 at 19:52)</a>:</h4>
<p>imo, the proper solution is that you can't rely on <code>impl Trait</code> being <code>Send</code> unless you add <code>impl Trait + Send</code></p>



<a name="210567758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567758">(Sep 18 2020 at 19:53)</a>:</h4>
<p>But...that has it's own problems</p>



<a name="210567768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567768">(Sep 18 2020 at 19:53)</a>:</h4>
<p>and isn't backwards compat anyways</p>



<a name="210567900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567900">(Sep 18 2020 at 19:54)</a>:</h4>
<p>maybe an <code>impl Trait + !Send</code> or <code>impl Trait + ?Send</code> would be better?</p>



<a name="210567902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210567902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210567902">(Sep 18 2020 at 19:54)</a>:</h4>
<p>idk</p>



<a name="210568225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210568225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210568225">(Sep 18 2020 at 19:57)</a>:</h4>
<p>not relitigating this :)</p>



<a name="210568331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210568331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210568331">(Sep 18 2020 at 19:58)</a>:</h4>
<p>oops lol</p>



<a name="210570262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210570262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210570262">(Sep 18 2020 at 20:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210565581">said</a>:</p>
<blockquote>
<p>what I meant <span class="user-mention silent" data-user-id="335294">memoryleak47</span> about <code>impl !Send for Foo</code> is I guess this, trying to explain as best I can:</p>
</blockquote>
<p>Thanks for the explanation! :D</p>



<a name="210570611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210570611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210570611">(Sep 18 2020 at 20:17)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span><br>
I just implemented the note from <span class="user-mention" data-user-id="251766">@Areredify</span> (which drastically simplified the code <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span> ) and made your requested changes somewhat obsolete, as the underlying code is just gone.<br>
So you may want to re-review it.</p>



<a name="210570958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210570958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210570958">(Sep 18 2020 at 20:21)</a>:</h4>
<p>Looks much better</p>



<a name="210606873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210606873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210606873">(Sep 19 2020 at 09:41)</a>:</h4>
<p>I wonder about closures a bit.<br>
The captured variables live in <code>closure_upvars</code> apparently.<br>
Is is true that it gives me <code>Binders&lt;Ty&gt;</code> because of potential lifetimes to the stack (i.e. the Binders will only have VariableKind::Lifetime)?<br>
Because this would imply that I am free to do <code>.skip_binders()</code>, I believe.</p>



<a name="210606947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210606947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210606947">(Sep 19 2020 at 09:43)</a>:</h4>
<p>Hm... but then there would still be unbound variables returned which would cause trouble.<br>
I could insert the 'static lifetime possibly, but it feels kind of dangerous.</p>



<a name="210607408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210607408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210607408">(Sep 19 2020 at 09:56)</a>:</h4>
<p>In addition to that I wonder how I should work with opaque / associated types.<br>
I'd think that we just don't generate any impls for them, or should we try to normalize them?</p>



<a name="210608011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608011">(Sep 19 2020 at 10:17)</a>:</h4>
<p>Now we're getting to the harder bit :)</p>



<a name="210608091"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608091" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608091">(Sep 19 2020 at 10:19)</a>:</h4>
<p>So for closures, upvars give a tuple of types, not lifetimes IIRC, and those should be the constituent types.</p>



<a name="210608109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608109">(Sep 19 2020 at 10:19)</a>:</h4>
<p>Hm.. in the docs it says that one should not assume anything about the type, though</p>



<a name="210608112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608112">(Sep 19 2020 at 10:20)</a>:</h4>
<p>So, opaque and associated types, I'll have to check how rustc does it</p>



<a name="210608156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608156">(Sep 19 2020 at 10:20)</a>:</h4>
<p>Where?</p>



<a name="210608160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608160">(Sep 19 2020 at 10:20)</a>:</h4>
<p><span class="user-mention silent" data-user-id="335294">memoryleak47</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210608109">said</a>:</p>
<blockquote>
<p>Hm.. in the docs it says that one should not assume anything about the type, though</p>
</blockquote>
<p>There are no restrictions on the type of upvars.<br>
<a href="https://rust-lang.github.io/chalk/chalk_solve/trait.RustIrDatabase.html#tymethod.closure_upvars">https://rust-lang.github.io/chalk/chalk_solve/trait.RustIrDatabase.html#tymethod.closure_upvars</a></p>



<a name="210608249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608249">(Sep 19 2020 at 10:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210608112">said</a>:</p>
<blockquote>
<p>So, opaque and associated types, I'll have to check how rustc does it</p>
</blockquote>
<p>Ah, I can do that too. But I'd require a starting point, didn't find anything relevant by myself.</p>



<a name="210608324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608324">(Sep 19 2020 at 10:24)</a>:</h4>
<p>Also, I wonder whats the semantical difference of <code>TyData::Apply(ApplicationTy { name: TypeName::Opaque, ..})</code> vs. <code>TyData::Alias(AliasTy::Opaque(...))</code></p>



<a name="210608487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608487">(Sep 19 2020 at 10:28)</a>:</h4>
<p>Oops, for upvars, I think we can only care about the types</p>



<a name="210608489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608489">(Sep 19 2020 at 10:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210608091">said</a>:</p>
<blockquote>
<p>So for closures, upvars give a tuple of types, not lifetimes IIRC, and those should be the constituent types.</p>
</blockquote>
<p>I'm asking what the <code>Binders&lt;_&gt;</code> does, not the <code>Ty</code> inside.</p>



<a name="210608492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608492">(Sep 19 2020 at 10:28)</a>:</h4>
<p>I can try to get you a link in rustc</p>



<a name="210608500"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608500" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608500">(Sep 19 2020 at 10:28)</a>:</h4>
<p>So, the Binders are late bound vars</p>



<a name="210608511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608511">(Sep 19 2020 at 10:29)</a>:</h4>
<p>I think it should only be lifetimes</p>



<a name="210608520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608520">(Sep 19 2020 at 10:29)</a>:</h4>
<p>So, you would do forall</p>



<a name="210608534"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608534" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608534">(Sep 19 2020 at 10:29)</a>:</h4>
<p>Sorry, on mobile currently so can't be super precise.</p>



<a name="210608582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608582">(Sep 19 2020 at 10:30)</a>:</h4>
<p>You mean <code>for&lt;&gt; ...</code>?</p>



<a name="210608638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608638">(Sep 19 2020 at 10:32)</a>:</h4>
<p>err, sorry - like this <code>for&lt;'a&gt; Fn(&amp;'a i32)</code>?</p>



<a name="210608757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608757">(Sep 19 2020 at 10:34)</a>:</h4>
<p>Right, so one of the conditions would be <code>forall&lt;'a,...&gt; &lt;tuple&gt;: AutoTrait</code></p>



<a name="210608778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608778">(Sep 19 2020 at 10:35)</a>:</h4>
<p>Btw I'm also cool if you want to finish up the PR for the next simple cases already covered</p>



<a name="210608779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608779">(Sep 19 2020 at 10:35)</a>:</h4>
<p>And the do a followup PR for the more complicated ones</p>



<a name="210608816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608816">(Sep 19 2020 at 10:36)</a>:</h4>
<p>Yeah, maybe thats better (:</p>



<a name="210608879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608879">(Sep 19 2020 at 10:38)</a>:</h4>
<p>Yeah, I probably prefer that tbh</p>



<a name="210608881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608881">(Sep 19 2020 at 10:38)</a>:</h4>
<p>Like I said, these are the harder bits</p>



<a name="210608883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608883">(Sep 19 2020 at 10:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="232957">Jack Huey</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210608757">said</a>:</p>
<blockquote>
<p>Right, so one of the conditions would be <code>forall&lt;'a,...&gt; &lt;tuple&gt;: AutoTrait</code></p>
</blockquote>
<p>Ah, you mean using a chalk <code>forall&lt;'a&gt; { ... }</code> clause and not the <code>for&lt;&gt;</code>syntax. That makes a lot of sense. :)<br>
I think I can sneak this in, and then make the PR ready for merging!</p>



<a name="210608889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608889">(Sep 19 2020 at 10:38)</a>:</h4>
<p>Awesome!</p>



<a name="210608895"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608895" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608895">(Sep 19 2020 at 10:39)</a>:</h4>
<p>I think the big things left for the PR are tests</p>



<a name="210608897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608897">(Sep 19 2020 at 10:39)</a>:</h4>
<p>Ah, right.</p>



<a name="210608902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608902">(Sep 19 2020 at 10:39)</a>:</h4>
<p>and I guess I need to update the book</p>



<a name="210608947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210608947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210608947">(Sep 19 2020 at 10:40)</a>:</h4>
<p>That too</p>



<a name="210610204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210610204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210610204">(Sep 19 2020 at 11:20)</a>:</h4>
<p>Well.. how do I actually compile the book?</p>



<a name="210611212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210611212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210611212">(Sep 19 2020 at 11:47)</a>:</h4>
<p>If you look at <code>ci.yml</code>, it's doing <code>cd book &amp;&amp; ./mdbook build</code></p>



<a name="210611258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210611258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210611258">(Sep 19 2020 at 11:48)</a>:</h4>
<p>But <code>cargo install mdbook</code> might be easier than the curl stuff that CI is doing</p>



<a name="210611271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210611271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210611271">(Sep 19 2020 at 11:49)</a>:</h4>
<p>Thanks (:</p>



<a name="210611272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210611272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210611272">(Sep 19 2020 at 11:49)</a>:</h4>
<p>Though if you have an editor with markdown preview, you can just use that and rely on CI to catch mistakes</p>



<a name="210611762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210611762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210611762">(Sep 19 2020 at 12:03)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> ready to review <a href="https://github.com/rust-lang/chalk/pull/612">https://github.com/rust-lang/chalk/pull/612</a></p>



<a name="210612153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210612153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210612153">(Sep 19 2020 at 12:13)</a>:</h4>
<p>Ah, I forgot about this <code>// TODO record app_ty</code>-thingy from <code>logging_db.rs</code>.<br>
Should I add another enum-variant for that or should I just ignore it?</p>



<a name="210619524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210619524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210619524">(Sep 19 2020 at 15:04)</a>:</h4>
<p>I mean, I imagine you only need to record adts still?</p>



<a name="210619601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210619601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210619601">(Sep 19 2020 at 15:06)</a>:</h4>
<p>Ok, gimme a second</p>



<a name="210620156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620156">(Sep 19 2020 at 15:19)</a>:</h4>
<p><span class="user-mention" data-user-id="251766">@Areredify</span></p>
<blockquote>
<p>PhantomData&lt;T&gt; should have T as a constituent type</p>
</blockquote>
<p>Interesting, whats the rationale on this?</p>



<a name="210620221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620221">(Sep 19 2020 at 15:20)</a>:</h4>
<p>the point of phantom data is to pretend you own data of type T</p>



<a name="210620224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620224">(Sep 19 2020 at 15:20)</a>:</h4>
<p>Beat me</p>



<a name="210620226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620226">(Sep 19 2020 at 15:20)</a>:</h4>
<p>But yes</p>



<a name="210620230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620230">(Sep 19 2020 at 15:20)</a>:</h4>
<p>Haha, okay ^^</p>



<a name="210620235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620235">(Sep 19 2020 at 15:21)</a>:</h4>
<p>also you should consult with rustc when implementing these sorts of things</p>



<a name="210620237"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620237" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620237">(Sep 19 2020 at 15:21)</a>:</h4>
<p>Should I read out flags.phantom_data?</p>



<a name="210620239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620239">(Sep 19 2020 at 15:21)</a>:</h4>
<p>yes</p>



<a name="210620258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620258">(Sep 19 2020 at 15:21)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/c10ad0d888df19e7185e15f811fdb011278f3c20/compiler/rustc_trait_selection/src/traits/select/mod.rs#L1698">constituent types in rustc</a></p>



<a name="210620322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210620322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210620322">(Sep 19 2020 at 15:22)</a>:</h4>
<p>Ah, thanks for the pointer!</p>



<a name="210621951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210621951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210621951">(Sep 19 2020 at 16:01)</a>:</h4>
<p>Alright, I guess the PR is ready for the next iteration of review ^^</p>



<a name="210621957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210621957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210621957">(Sep 19 2020 at 16:01)</a>:</h4>
<p><span class="user-mention" data-user-id="232957">@Jack Huey</span> <span class="user-mention" data-user-id="251766">@Areredify</span></p>



<a name="210621961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210621961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210621961">(Sep 19 2020 at 16:01)</a>:</h4>
<p><a href="https://github.com/rust-lang/chalk/pull/612">https://github.com/rust-lang/chalk/pull/612</a></p>



<a name="210622667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210622667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210622667">(Sep 19 2020 at 16:17)</a>:</h4>
<p>Reviewed :)</p>



<a name="210624637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210624637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210624637">(Sep 19 2020 at 17:02)</a>:</h4>
<p>I moved the Foreign-check.<br>
Doesn't feel so nice to return an Option for this one special case, I think.</p>



<a name="210731109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210731109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210731109">(Sep 21 2020 at 12:01)</a>:</h4>
<p>So, I'll need some guidance for opaque / assoc. types.<br>
My first guess would be to build a "my_opaque_type :- hidden_type" clause.<br>
But I don't know whether a hidden type is generally determined at this point in the compilation.</p>
<p>Also, I'm not sure how ApplicationTy::Opaque and TyData::Alias(Opaque) differ in semantics.</p>



<a name="210731976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210731976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210731976">(Sep 21 2020 at 12:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="335294">memoryleak47</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210731109">said</a>:</p>
<blockquote>
<p>But I don't know whether a hidden type is generally determined at this point in the compilation.</p>
</blockquote>
<p>That's what <code>if (Reveal) { .. }</code> checks are for</p>



<a name="210734230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210734230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210734230">(Sep 21 2020 at 12:35)</a>:</h4>
<p>I thought opaque types don't get auto traits</p>



<a name="210734609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210734609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210734609">(Sep 21 2020 at 12:39)</a>:</h4>
<p>hmm, apparently they do</p>



<a name="210734985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210734985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210734985">(Sep 21 2020 at 12:42)</a>:</h4>
<p>huh?</p>



<a name="210735163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735163">(Sep 21 2020 at 12:44)</a>:</h4>
<p>I find this behavior highly surprising</p>



<a name="210735300"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735300" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735300">(Sep 21 2020 at 12:45)</a>:</h4>
<p>I imagine opaque types only get auto traits from their bounds, not from the hidden type, right?</p>



<a name="210735324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735324">(Sep 21 2020 at 12:45)</a>:</h4>
<p>thats why I am surprised, they don't</p>



<a name="210735394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735394">(Sep 21 2020 at 12:46)</a>:</h4>
<p>You mean they don't get auto traits at all?</p>



<a name="210735419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735419">(Sep 21 2020 at 12:46)</a>:</h4>
<p>no they get auto traits from the hidden type</p>



<a name="210735423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735423">(Sep 21 2020 at 12:46)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=82081298b6189eba6ba8f8a44041384c">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=82081298b6189eba6ba8f8a44041384c</a></p>



<a name="210735847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735847">(Sep 21 2020 at 12:50)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=0d1a6b3865bdd5bda0b2848d24ef3c2d">expanded example</a></p>



<a name="210735900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735900">(Sep 21 2020 at 12:50)</a>:</h4>
<p>surely there is an issue for this</p>



<a name="210735974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210735974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210735974">(Sep 21 2020 at 12:51)</a>:</h4>
<p>Oh right, that was in the <a href="https://github.com/rust-lang/rfcs/blob/master/text/1522-conservative-impl-trait.md#semantics">impl trait RFC</a>:</p>
<blockquote>
<p>Because OIBITS like Send and Sync will leak through an abstract return type, there will be some additional complexity in the compiler due to some non-local type checking becoming necessary.</p>
</blockquote>



<a name="210736208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210736208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210736208">(Sep 21 2020 at 12:53)</a>:</h4>
<p>There's even a <a href="https://stackoverflow.com/questions/59037266/why-does-an-impl-trait-return-value-implement-send-while-boxdyn-trait-does">stackoverflow question</a> about this</p>



<a name="210736385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210736385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> detrumi <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210736385">(Sep 21 2020 at 12:55)</a>:</h4>
<p>We should document this in the chalk book</p>



<a name="210736406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210736406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210736406">(Sep 21 2020 at 12:55)</a>:</h4>
<p>bless shepmaster</p>



<a name="210736844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210736844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210736844">(Sep 21 2020 at 12:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125131">detrumi</span> <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210736385">said</a>:</p>
<blockquote>
<p>We should document this in the chalk book</p>
</blockquote>
<p>yeah probably</p>



<a name="210737566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210737566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jack Huey <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210737566">(Sep 21 2020 at 13:04)</a>:</h4>
<p>btw Niko and I discussed this literally just Friday lol: <a href="#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210566536">https://rust-lang.zulipchat.com/#narrow/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits/near/210566536</a></p>



<a name="210737594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210737594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210737594">(Sep 21 2020 at 13:04)</a>:</h4>
<p>oh</p>



<a name="210737640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210737640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210737640">(Sep 21 2020 at 13:05)</a>:</h4>
<p>I read nikos big message and skipped the rest <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<a name="210737688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210737688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Areredify <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210737688">(Sep 21 2020 at 13:05)</a>:</h4>
<p>deserved, I guess</p>



<a name="210757837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/144729-wg-traits/topic/Advice%20for%20auto%20traits/near/210757837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> memoryleak47 <a href="https://rust-lang.github.io/zulip_archive/stream/144729-wg-traits/topic/Advice.20for.20auto.20traits.html#210757837">(Sep 21 2020 at 15:28)</a>:</h4>
<p>There is already a function <code>fn push_auto_trait_impls_opaque</code> which generates <code>opaque: Trait :- hidden: Trait</code>, but its only called for TyData::Alias(Opaque) and not for the ApplicationTy so far.<br>
Again, I'm not aware of the semantical difference between the two, but if their difference is not relevant to auto traits, then I could simply call this function from <code>push_auto_trait_impls</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>